//
//  RootViewController.m
//  changeView
//
//  Created by chenlishuang on 16/8/1.
//  Copyright © 2016年 chenlishuang. All rights reserved.
//

#import "RootViewController.h"
#import "MyView.h"
#define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height
@interface RootViewController ()<UIScrollViewDelegate>
@property (nonatomic,strong)MyView *myView;
@end

@implementation RootViewController

//- (void)loadView{
////    self.myView = [[MyView alloc]initWithFrame:[UIScreen mainScreen].bounds];
////    self.view = self.myView;
//}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.myView = [[MyView alloc]initWithFrame:CGRectMake(0, 64, kScreenWidth, kScreenHeight-64)];
    self.myView.scrollView.delegate = self;
    [self.view addSubview:self.myView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//结束减速
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    [UIView animateWithDuration:0.3 animations:^{
        self.myView.view.frame = CGRectMake(scrollView.contentOffset.x/3, 10, kScreenWidth/3, 50);
    }];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
